home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-09-10 | 2.9 KB | 136 lines | [TEXT/MSWD] |
- Movie2Snd is a very simple application which extracts soundtracks from
- QuickTime movies.
-
- Drop-launch a movie onto the application (or choose a movie from the open dialog).
- You will be prompted for a location for the resulting sound file. That sound
- file is a plain ol' System 7 sound file that can be played by opening
- (double clicking).
-
- Movie2Snd does all of its work in memory, so you'll need to set the application
- memory size large enough to accommodate the sound. 1/2 of the target movie's file
- size is a good rule of thumb. Like I said, this is a very simple program with
- practically no user interface. If an error occurs, it just beeps at you
- (QuickTime isn't installed, not enough memory, etc.)
-
-
- Version 1.0.1 allows you to preview movies in the open dialog.
-
-
- -- Scott Lindsey <wombat@claris.com>
-
- MovieSilencer is neither a product of nor is supported by Claris Corporation.
- This program is freely distributable. Here's the source:
-
- // (No, this isn't very good example-ware. It's just a quick hack.)
-
- #include <MacHeaders>
- #include <Aliases.h>
- #include <Folders.h>
- #include <Movies.h>
- #include <Sound.h>
- #include <ImageCompression.h>
-
- void MakeSnd(FSSpec *);
-
- void main(void)
- {
- long response;
- short Action, Count;
- OSErr err;
- AppFile File;
- FSSpec fs;
- SFTypeList types = {'MooV'};
-
- if (Gestalt(gestaltQuickTime, &response))
- {
- SysBeep(5);
- ExitToShell();
- }
-
- MaxApplZone();
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- EnterMovies();
-
- // Yeah, yeah, I oughta use AppleEvents
-
- CountAppFiles(&Action, &Count);
- if (Action == appPrint)
- ExitToShell();
-
- if (Count)
- {
- GetAppFiles(Count, &File);
- FSMakeFSSpec(File.vRefNum, 0L, File.fName, &fs);
- }
- else
- {
- StandardFileReply reply;
-
- StandardGetFilePreview(0L, 1, types, &reply);
- if (!reply.sfGood)
- ExitToShell();
- fs = reply.sfFile;
- Count = 1;
- }
-
- for (;;)
- {
- MakeSnd(&fs);
- if (!--Count)
- break;
- GetAppFiles(Count, &File);
- FSMakeFSSpec(File.vRefNum, 0L, File.fName, &fs);
- }
-
- ExitToShell();
- }
-
- void MakeSnd(FSSpec *fs)
- {
- short refNum, resID = 0;
- Movie movie;
- OSErr err;
- StandardFileReply reply;
- Handle h;
-
- if (err = OpenMovieFile(fs, &refNum, fsRdPerm))
- goto failed;
- if (err = NewMovieFromFile(&movie, refNum, &resID, nil, newMovieActive, nil))
- goto failed;
- err = CloseMovieFile(refNum);
-
- // Maybe make default name based on movie name?
-
- StandardPutFile("\pSave Sound as:", "\pA Sound", &reply);
-
- if (reply.sfGood)
- {
- if (reply.sfReplacing)
- FSpDelete(&reply.sfFile);
- FSpCreateResFile(&reply.sfFile, 'movr', 'sfil', -1);
- refNum = FSpOpenResFile(&reply.sfFile, fsWrPerm);
- h = NewHandle(1024);
- err = PutMovieIntoTypedHandle(movie, 0, 'snd ', h, 0, GetMovieDuration(movie), 0, 0);
- if (!err)
- AddResource(h, 'snd ', 128, reply.sfFile.name);
- CloseResFile(refNum);
-
- if (err)
- {
- FSpDelete(&reply.sfFile);
- goto failed;
- }
- }
- return;
-
- failed:
- SysBeep(5);
- return;
- }
-